﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LuckyLoot.Common.Validation;

namespace LuckyLoot.Common
{
    public static class DateTimeConverter
    {
        public static DateTime? ToDateTime(this String value)
        {
            var treatedString = value.Trim();
            if (!string.IsNullOrEmpty(treatedString))
            {
                DateTime dateTimeValue;
                if (DateTime.TryParse(treatedString, out dateTimeValue))
                    return dateTimeValue;
            }
            return null;
        }
    }
}
